import { Image } from "antd-mobile";
import React from "react";
import { Link } from "react-router-dom";
import "./NewsItem.less";
const NewsItem = (props) => {
  const { info } = props;
  if (!info) return null;
  let { id, title, hint, images, image } = info;
  if (!images) images = [image];
  if (!Array.isArray(images)) images = [""];
  return (
    <div className='news-item-box'>
      <Link to={{ pathname: `/detail/${id}` }}>
        <div className='content'>
          <h4 className='title'>{title}</h4>
          {hint ? <p className='author'>{hint}</p> : null}
        </div>
        <Image src={images[0]} lazy />
      </Link>
    </div>
  );
};

export default NewsItem;
